import 'package:flutter/material.dart';
import 'package:inspiration_f/model/home_mode.dart';
import 'package:inspiration_f/utils/color.dart';
import 'package:inspiration_f/utils/size.dart';

// 首页的item
class HomeItem extends StatefulWidget {
  HomeModel? currentModel;
  VoidCallback? clickAction;
  HomeItem({super.key, required this.currentModel});

  @override
  State<HomeItem> createState() => _HomeItemState();
}

class _HomeItemState extends State<HomeItem> {
  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: widget.clickAction,
      // highlightColor: xmBgColor,
      // hoverColor: xmBgColor,
      // splashColor: xmBgColor,
      highlightColor: Colors.transparent,
      hoverColor: Colors.transparent,
      splashColor: Colors.transparent,
      child: ClipRRect(
        borderRadius: BorderRadius.circular(30),
        child: Container(
          height: homeItemHeight,
          padding: const EdgeInsets.only(left: 16, right: 16),
          alignment: Alignment.centerLeft,
          color: XMColor.getColor(widget.currentModel?.colorInt ?? 0),
          child: Text(
            widget.currentModel?.title ?? "",
            maxLines: 1,
            overflow: TextOverflow.ellipsis,
            style: const TextStyle(
                fontSize: 16, fontWeight: FontWeight.w500, color: Colors.white),
          ),
        ),
      ),
    );
  }
}
